package com.salt.admin.api.feign.client;

import com.salt.admin.api.feign.hystrix.TenantClientHystrix;
import com.salt.admin.api.feign.interceptor.FeignTokenInterceptor;
import com.salt.admin.api.model.MultiTenant;
import com.salt.admin.api.model.User;
import com.salt.common.constant.Common;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @Description
 * @Author salt
 * @Date 2022/1/21
 * @Version 1.0.1
 */
@Repository
@FeignClient(name = Common.Service.SALT_ADMIN_SERVICE_NAME,
        path = Common.Service.SALT_ADMIN_TENANT_URL_PREFIX,
        fallbackFactory = TenantClientHystrix.class,
        configuration = FeignTokenInterceptor.class)
public interface TenantClient {

    @GetMapping("find")
    public MultiTenant find();

    @PostMapping("findByUser")
    public MultiTenant findByUser(User user);
}
